package com.book.controller;


import com.book.pojo.Reward;
import com.book.result.Result;
import com.book.service.RewardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fk
 * @since 2023-10-14 11:34:14
 */
@RestController
@RequestMapping("/reward")
public class RewardController {

    @Autowired
    private RewardService rewardService;

    @GetMapping("RewardRanking")
    public List<Reward> RewardRanking(){
        return rewardService.RewardRanking();
    }

    //读者可以重复对一本书打赏 打赏榜实时更新
    @PostMapping("addReward")
    public Result addReward(@RequestBody Reward reward){
        rewardService.addReward(reward);
        return Result.OK();

    }
}
